A linear time algorithm for consecutive permutation pattern matching
نویسندگان
چکیده
We say that two sequences x and w of length m are order-isomorphic (of the same “shape”) if w[i] ≤ w[j] if and only if x[i] ≤ x[j] for each i, j ∈ [1,m]. We present a simple linear time algorithm for checking if a given sequence y of length n contains a factor which is order-isomorphic to a given pattern x. A factor is a subsequence of consecutive symbols of y, so we call our problem the consecutive permutation pattern matching. The (general) permutation pattern matching problem is related to general subsequences and is known to be NP-complete. We show that the situation for consecutive subsequences is significantly different and present an O(n + m) time algorithm under a natural assumption that the symbols of x can be sorted in O(m) time, otherwise the time is O(n + m logm). In our algorithm we use a modification of the classical Knuth-Morris-Pratt string matching algorithm.
منابع مشابه
A Linear Formulation of the Graph Edit Distance for Graph Recognition
An efficient graph matching algorithm based on optimizing the graph edit distance is presented. The graph edit distance is expressed as a linear function of a permutation matrix and a sequence of edit matrices which represent graph edit operations. This allows the development of a linear program that is solved using an interior point method. The linear optimization produces a continuous analog ...
متن کاملA reciprocity approach to computing generating functions for permutations with no pattern matches
2011 Using the reciprocal to calculate generating functions for permutations with no consecutive pattern matches Permutation Patterns 2011 San Luis Obispo, CA 2011 Reciprocal method to enumerate permutations with no consecutive pattern matches FPSAC 2011 Reykjavik, Iceland 2010 Pattern matching in the cycle structure of permutations Permutation Patterns 2010 Dartmouth, NH 2010 Advancement to ca...
متن کاملPermutation Editing and Matching via Embeddings
If the genetic maps of two species are modelled as permutations of (homologous) genes, the number of chromosomal rearrangements in the form of deletions, block moves, inversions etc. to transform one such permutation to another can be used as a measure of their evolutionary distance. Motivated by such scenarios, we study problems of computing distances between permutations as well as matching p...
متن کاملA Simple Test for the Consecutive Ones Property
A (0,1)-matrix satisfies the consecutive ones property if there exists a column permutation such that the ones in each row of the resulting matrix are consecutive. Booth and Lueker [1976] designed a linear time testing algorithm for this property based on a data structure called "PQ-trees". This procedure is quite complicated and the linear time amortized analysis is also rather involved. We de...
متن کاملMILP Formulation and Genetic Algorithm for Non-permutation Flow Shop Scheduling Problem with Availability Constraints
In this paper, we consider a flow shop scheduling problem with availability constraints (FSSPAC) for the objective of minimizing the makespan. In such a problem, machines are not continuously available for processing jobs due to preventive maintenance activities. We proposed a mixed-integer linear programming (MILP) model for this problem which can generate non-permutation schedules. Furthermor...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- Inf. Process. Lett.
دوره 113 شماره
صفحات -
تاریخ انتشار 2013